// pages/login/login.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    "studentId":"",
    "password":""
  },

  login(){
      let that = this
      console.log(this.data.password)
      wx.request({
      method:"POST",
      url:"http://localhost:8080/user/login",
      header: {
        'content-type': 'application/json' // 默认值
      },
      data:{
        "sno" :that.data.studentId,
        "password" :that.data.password
      },
      success:function(res){
        wx.setStorageSync("cookieKey", res.header["Set-Cookie"]);
        console.log(res.header["Set-Cookie"])
        console.log(res.data)
        console.log(res.header)
        wx.switchTab({
          url: '../home/home',
        })
      },
      fail:function(err){
      console.log(err)
      }
      })
  },
  register(){
    this.setData({
      "studentId":"",
      "password":""
    })
    wx.navigateTo({
      url: '../register/register',
    })
  }
}

)

